<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="zh-CN">
<head>
</head>
<body>
</body>
<script src="${basePath }/js/echarts-2.1.10/build/dist/echarts.js"></script>
<script type="text/javascript">
var the = $.cookie('the_cookie');
var unit = "${unit}";
var arrayObj = the==null?new Array():eval("("+the+")");
var flag = '${sessionScope.login_user_id eq null }';
if(the==null||flag!='true'||arrayObj.length==0){
	if($('.duibi .duibi-left ul').find("a").size()==0){
	 var tbody = "";
	<c:forEach items="${listNameDetileOrId }" var="data"  varStatus="stat"> 
		var platform = {
					'pid':'${data.platform_id}',
					'pname':'${data.platform_name}',
					 'issubmit':1
			};
		 var trs = "";
		 var c = 0;
		 if('${stat.index}'<5){
	     	trs += "<li><label for='pingtai${stat.index}' class='checkedbg'><input name='pingtai' onmouseover='this.style.cursor=\"hand\"' class='mycheckbox' checked='checked' type='checkbox' id='pingtai${stat.index}'>"+'${data.platform_name}'+"</label><a class='qa' href='javascript:void(0)' value='${data.platform_id}' title='取消对比'></a></li>";
		 }else{
			 trs += "<li><label for='pingtai${stat.index}' ><input name='pingtai' class='mycheckbox' onmouseover='this.style.cursor=\"hand\"' type='checkbox' id='pingtai${stat.index}'>"+'${data.platform_name}'+"</label><a class='qa' href='javascript:void(0)' value='${data.platform_id}' title='取消对比'></a></li>";
		 }
	     tbody += trs;
	     c++;
	     arrayObj.push(platform);
	     </c:forEach >
	     $.cookie('the_cookie', JSON.stringify(arrayObj),{path:"/"});
	     $('.duibi .duibi-left ul').html(""); 
	$('.duibi .duibi-left ul').html(tbody); 
	}
	
	var tbody2 = "";
	 //下面使用each进行遍历  
	 $.each(arrayObj,function(n,value) {
		 if(value.issubmit==0||n<=3){
	          var str = "";
	          str += "<li><a href='javascript:void(0)' title='取消对比' id=duibi"+value.pid+" value="+value.pid+" onclick='quxiao("+value.pid+")'>"+value.pname+"</a></li>";
	          tbody2 += str;
		 }
	  });  
	//初始化购物车
	var duibi = $(".duibi-list").find("ul");
	duibi.html("");
	duibi.html(tbody2);
	//$(".duibi-list").show();
}

//路径配置
require.config({
    paths: {
        echarts : '${basePath }/js/echarts-2.1.10/build/dist'
    }
});

// 使用
require(
		 [
	        'echarts',
	        'echarts/chart/line' // 使用柱状图就加载bar模块，按需加载
	    ],
	    function (ec) {
	        // 基于准备好的dom，初始化echarts图表
	        var myChart = ec.init(document.getElementById('baobiao')); 
	    option = {
	    		 grid :{
	      			x:70,
	      			y:30,
	      			x2:15,
	      			y2:23
	      		},
	    	    legend: {
	    	        data:[<c:forEach items="${dataList }" var="data"  varStatus="stat">      
	    	       			 '${data}'
	    	        		<c:if test="${!stat.last}">,</c:if>
	    	        		</c:forEach>
	    	              ],
	    			x:'right'
	    	    },
	     	   
	    	    tooltip : {
	    	        trigger: 'axis',
	    	        formatter: function (params) {
	    	        	var res = params[0].name+"<br/>";
	    	        	for(var i=0;i<params.length;i++){
	    	        		if(unit=='亿'){
	    	        			unit='万元';
	    	        		}
	    	        		res += params[i].seriesName+':'+(params[i].value).toFixed(2)+unit;
	    	        		res += '<br/>';
	    	        	}
	    	        	//res += params[1].seriesName+':'+params[1].value+'万元';
	    	        	return res;
	    	        }
	    	        
	    	    },
	    	    calculable : false,
	    	    xAxis : [
	    	        {
	    	        	type : 'category',
	    	            boundaryGap : false,
		       	    axisLabel:{
		       	    	fontFamily:'微软雅黑'
		       	       },
	    	            axisLine :{
	       	        	  show:true,
	       	        	lineStyle : {color:'#CCC',width: 2,type: 'solid'}  
	       	        	  
	       	          },
	    	            data :${xzhou}	
	    	        }
	    	    ],
	    	    yAxis : [
	    	    	        {
	    	    	            type : 'value',
	    	    	            axisLabel : {
	    	     	            	formatter: function (data){
	    	     	            		if((${dayOrMonth}==3 || ${dayOrMonth}==2 ) &&  ("${orderByVariable}" == "investment_num"  || "${orderByVariable}" == "borrower_num")) {
	    	     	            			return (data/10000).toFixed(1)+"万人";
	    	     	            		}
	    	     	            		if(unit=='亿'){return (data/10000).toFixed(1)+unit;}else if(unit=='万元'){
	    	     	            			return (data/10000).toFixed(1)+"亿";
	    	     	            		} else{
	    	     	            			return data + unit;
	    	     	            		}
	    	     	            	},
	    	     	            },
	    		    	        axisLine :{
	    		     	        	  show:true,
	    		     	        	 lineStyle : {color:'#CCC',width: 2,type: 'solid'} 
	    		     	        	  
	    		     	          }
	    	    	        }
	    	    	    ],
	    	    	    series : [
	    	    	    	       
	    	    					${baobiaoText}
	    	    				
	    	    	    	    ]
			    };
	    myChart.setOption(option); 
	    });
function detileData(valueData){
    	return valueData/10000;
}

</script>
</html>